package cn.wolfcode.mapper;

import cn.wolfcode.domain.Employee;
import cn.wolfcode.qo.QueryObject;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface EmployeeMapper {
    /**
     * 根据id删除员工
     * @param id
     * @return
     */
    int deleteByPrimaryKey(Long id);

    /**
     * 添加员工
     * @param record
     * @return
     */
    int insert(Employee record);

    /**
     * 根据员工ID查询员工信息
     * @param id 员工ID
     * @return 返回Employee对象
     */
    Employee selectByPrimaryKey(Long id);

    /**
     * 查询所有员工信息
     * @return
     */
    List<Employee> selectAll();

    /**
     * 更新员工信息
     * @param record
     * @return
     */
    int updateByPrimaryKey(Employee record);

//    int selForCount(QueryObject qo);

    List<Employee> selForList(QueryObject qo);

    /**
     * 中间表删除
     * @param employeeId
     */
    void deleteMiddleTable(Long employeeId);

    /**
     * 中间表添加
     * @param employeeId
     * @param roleIds
     */
    void insertToMiddleTable(@Param("employeeId") Long employeeId, @Param("roleIds") Long[] roleIds);

    int checkUsername(String username);

    /**
     * 根据员工账号密码拿到员工信息
     * @param username
     * @param password
     * @return
     */
    Employee checkUserByUsernameAndPassword(@Param("username") String username, @Param("password") String password);

    Employee selectByUsername(String username);
}

